﻿using Microsoft.Practices.Unity.Utility;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;

namespace Artech.Common
{
    public static class CultureInfoExtensions
    {
        public static string GetLanguage(this CultureInfo culture)
        {
            Guard.ArgumentNotNull(culture, "culture");
            return culture.TwoLetterISOLanguageName.ToLower();
        }

        public static string GetRegion(this CultureInfo culture)
        {
            Guard.ArgumentNotNull(culture, "culture");
            string[] split = culture.Name.Split('-');
            if (split.Length > 1)
            {
                return split[1].ToUpper();
            }
            return string.Empty;
        }
    }
}
